"use strict";
commonDirective.directive("faMenu",["$http",function($http){
    return{
        restrict:"E",
        replace:true,
        templateUrl:"js/directives/fa-menu/fa-menu-template.html",
        link:function(scope, element, attrs){
            scope.menus = undefined;
            scope.isShowMenus = true;
            $http.get('api/menu.json').then(function(data){
                console.log(data);
                scope.menus = data.data;
            })

            scope.clickChildNode=function(target){
                angular.forEach(scope.menus,function(obj){
                    if(obj!=target){
                        obj.show=false;
                    }
                })
                if(target.show){
                    target.show=false;
                }else{
                    target.show=true;
                }
            }
        }
    }
}]);